package com.chixing.service.impl;

import com.chixing.mapper.CommentMapper;
import com.chixing.pojo.Comment;
import com.chixing.service.ReviewService;
import com.chixing.util.ServerResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ReviewServiceImpl implements ReviewService {
    @Autowired
    private CommentMapper commentMapper;
    @Override
    public Comment getById(Integer id) {
        return commentMapper.selectByPrimaryKey(id);
    }

    @Override
    public ServerResult save(Comment comment) {
        int rows=commentMapper.insert(comment);
        return rows>0?ServerResult.postSuccess(comment):ServerResult.postFail(null);
    }
}
